package com.jd.finance.core;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

import java.util.Arrays;

/**
 * @author liqingbo
 */
@Slf4j
@SpringBootApplication
@ComponentScan({"com.jd"})
public class CoreApplication {

    public static void main(String[] args) {
        try {
            SpringApplication.run(CoreApplication.class, args);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext ctx, Environment env) {
        return args -> {
            log.info("系统运行的配置:profile :{}", Arrays.toString(env.getActiveProfiles()));
            log.info("测试:{}", "http://127.0.0.1:" + env.getProperty("server.port")+env.getProperty("server.servlet.context-path")+"/doc.html");
        };
    }
}